package lexicalUnit;

import chalmersbot.Absyn.QWInW.Visitor;
import chalmersbot.Absyn.QWInW_1;
import chalmersbot.Absyn.QWInW_2;

public class CheckQWInW implements Visitor<String, Environ> {

	@Override
	public String visit(QWInW_1 p, Environ env) {
		env.setKind_of_answer(Environ.INWHICH_ANSWER);
		if (env.getKeywordClass()!=-1)
			env.setTarget(env.getKeywordClass());
		else
			throw new LexicalException("Any target was found");		
		//return env.getSubject() + " " + env.getVerb() + env.getRes() + " in " + env.generateAnswer();
		return null;
	}

	@Override
	public String visit(QWInW_2 p, Environ env) {
		env.setKind_of_answer(Environ.INWHICH_ANSWER);
		if (env.getKeywordClass()!=-1)
			env.setTarget(env.getKeywordClass());
		else
			throw new LexicalException("Any target was found");		
		//return "the " + env.getSubject() + " " + env.getVerb() + env.getRes() + " in " + env.generateAnswer();
		return null;
	}

}
